﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Qas.CommonLogic;
using Qas.CommonLogic.BusinessObjects;
using System.IO;
using Qas.User.Keepers;

namespace Qas.User
{
    static class Program
    {
        //private static int[] initConditions = { 1 };
        //private static int[] goalConditions = { 2 };

        //private static int budget = 99999;
        //private static int duration = 99999;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormUser());
            //Console.WriteLine("Hello, this is QAS");
            
            //Base currentBase = LoadBase(Qas.User.Properties.Resources.DefaultBasePath);

            //Console.WriteLine("Initial data:");
            //Console.WriteLine("I = {1}, G = {2}");

            //List<Condition> goals = FillConditions(goalConditions);
            //List<Condition> inits = FillConditions(initConditions);

            //IKeeper keeper = new BasicK(currentBase);

            //List<Plan> result = keeper.Search(currentBase.AvailableTasks, inits, goals);

            //Console.WriteLine("Results:");
            //foreach (Plan plan in result)
            //{
            //    foreach (Task task in plan.Tasks)
            //    {
            //        Console.Write(task.ID.ToString() + " ");
            //    }
            //    Console.WriteLine();
            //}
        }

        ///// <summary>
        ///// Загрузка (десериализация) базы
        ///// </summary>
        ///// <param name="basePath">Путь к файлу загружаемой базы</param>
        //private static Base LoadBase(string basePath)
        //{
        //    // Проверяем файл Базы на наличие
        //    if ((basePath == String.Empty) || (!File.Exists(basePath)))
        //        throw new NullReferenceException("Файл XML-базы не найден. Путь: " + basePath + "");

        //    Base result = DataMapper.LoadBaseFromXml(basePath);

        //    return result;
        //}


        //private static List<Condition> FillConditions(int[] conditions)
        //{
        //    List<Condition> result = new List<Condition>();
        //    foreach (Condition conditionItem in Base.CurrBase.ConditionList)
        //    {
        //        if (conditions.Contains<int>(conditionItem.ID))
        //        {
        //            result.Add(conditionItem);
        //        }
        //    }

        //    return result;
        //}
    }
}
